CMAKE_MINIMUM_REQUIRED(VERSION 3.15)
PROJECT(${APP_NAME})
SET(CMAKE_CXX_STANDARD 17)

# 导入Qt相关的模块
find_package(Qt6 COMPONENTS Core Quick Widgets Qml QuickControls2 REQUIRED)
qt_standard_project_setup()

# 设置Qt相关的变量
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)         # 资源文件处理
set(CMAKE_AUTOUIC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

set(QML_FILES
    qml/App.qml
    qml/MainWindow.qml
)

set(RESOURCES

)

# 源文件
aux_source_directory(./src/ SRC_LIST)

# 添加头文件
include_directories(${HEADPATH})

# 设置可执行文件输出路径
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${EXECPATH})
qt_add_executable(${APP_NAME} WIN32 main.cpp ${SRC_LIST})


# 设置Qt相关的依赖库
target_link_libraries(${APP_NAME} PRIVATE
Qt6::Widgets 
Qt6::Core
Qt6::QuickControls2
Qt6::Quick
Qt6::Qml
)

# 链接本地动态库
link_directories(${EXECPATH})
target_link_libraries(${APP_NAME} PRIVATE ${LIB_NAME})

# 设置 QML 资源文件路径
qt_add_qml_module(${APP_NAME}
    URI ${APP_NAME}
    VERSION 1.0
    QML_FILES ${QML_FILES}
    RESOURCES ${RESOURCES}
)
